﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
namespace WebClient
{
    public partial class Rehedit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.btnAddNew.Attributes.Add("onclick", "return OnSubmitClick();");
            this.btnCancel.Attributes.Add("onclick", "return ClearAll()");
        }

        private void AddNewItem()
        {
            WebData data = new WebData();
            Users item = new Users();
            
            item.userName = this.txtuserName.Text.Trim();
            item.fullName = this.txtfullName.Text.Trim();
            item.password = this.txtpassword.Text.Trim();
            item.email = this.txtemail.Text.Trim();
            item.create_on = DateTime.Now;
            item.groupID = 4;
            item.lastDate = DateTime.Now;
            item.status = 1;
            item.passDate = DateTime.Now;
            item.address = this.txtaddress.Text.Trim();
            item.phone = this.txtphone.Text.Trim();
            item.isActive = 1;
            item.birthDay = DateTime.Now;
            if(data.OnSubmitUsers(item, 0))
            {
                Response.Redirect("/Thanks.aspx");
            }
        }
        
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            AddNewItem();
        }
    }
}